package com.htd.htdapmservice.mybatis;


import com.htd.htdapmcommon.mybatis.DalBaseMyBatis;
import com.htd.htdapmdmo.LogAnalyzeErrorRecord;
import com.htd.htdapmservice.dao.LogAnalyzeErrorRecordDao;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class LogAnalyzeErrorRecordMapper extends DalBaseMyBatis<LogAnalyzeErrorRecord> implements LogAnalyzeErrorRecordDao {

    @Override
    public LogAnalyzeErrorRecord findLogAnalyzeErrorRecordById(int id){
        Map<String,Object> map  = new HashMap<String,Object>();
        map.put("id",id);
        return this.sqlSessionTemplate.selectOne(this.getEntityName() + ".getErrorLogById", map);
    }

    @Override
    public List<LogAnalyzeErrorRecord> findLogAnalyzeErrorRecordList(String title) {
        Map<String,Object> map  = new HashMap<String,Object>();
        map.put("alarmsTitle",title);
        return this.sqlSessionTemplate.selectList(this.getEntityName() + ".getErrorLogList", map);
    }

    @Override
    public List<LogAnalyzeErrorRecord> findLogAnalyzeErrorRecordListByStatus(String status) {
        Map<String,Object> map  = new HashMap<String,Object>();
        map.put("sendStatus",status);
        return this.sqlSessionTemplate.selectList(this.getEntityName() + ".findLogAnalyzeErrorRecordListByStatus", map);
    }

    @Override
    public int batchInsertLog(List<LogAnalyzeErrorRecord> logAnalyzeErrorRecords) {
        return this.sqlSessionTemplate.insert(this.getEntityName() + ".batchInsert", logAnalyzeErrorRecords);
    }

    @Override
    public int updateLogAnalyzeErrorRecordById(LogAnalyzeErrorRecord logAnalyzeErrorRecord) {
        return this.sqlSessionTemplate.update(this.getEntityName() + ".updateByPrimaryKey", logAnalyzeErrorRecord);
    }

}